package com.stockz.ui.swing.charting.display.indicator;

import java.awt.Graphics2D;
import java.util.List;

import org.springframework.stereotype.Component;

import com.stockz.core.model.Bar;
import com.stockz.indicator.smartVolume.SmartVolumeIndicator;
import com.stockz.ui.swing.charting.painter.indicator.LineIndicatorPainter;
import com.stockz.ui.swing.charting.util.UIChartingConstant.OVERLAY;

@Component
public class SmartVolumeIndicatorDisplay extends
		AbstractDisplayableIndicatorConfiguration {

	private final SmartVolumeIndicator indicator
		= new SmartVolumeIndicator();
	
	@Override
	public String getFullName() {
		return "Smart Volume";
	}

	@Override
	public String getShortName() {
		return "Smart Volume";
	}

	@Override
	public String getDescription() {
		return "Smart Volume"
				+", "+indicator.getIndicatorConfiguration().getStochasticsLowerLimit()
				+", "+indicator.getIndicatorConfiguration().getStochasticsUpperLimit()
				+", "+indicator.getIndicatorConfiguration().getStochasticsSpan()
				+", "+indicator.getIndicatorConfiguration().getVolumeMinimumMultiple()
				+", "+indicator.getIndicatorConfiguration().getVolumeSmaSpan();
				
	}

	@Override
	public OVERLAY getOverlay() {
		return OVERLAY.INDEPENDENT;
	}

	@Override
	public boolean isOverlappable() {
		return true;
	}

	@Override
	public void paint(Graphics2D g) {
		LineIndicatorPainter.paint(g, this);
	}

	@Override
	public Object getConfiguration() {
		return indicator.getIndicatorConfiguration();
	}

	@Override
	public void refreshValues() {
		List<Bar> barList = getStockChartPanel().getStockChartPanelState().getBarList();
		setValues(indicator.getValues(barList));
	}

}
